from typing import List, Optional
from pydantic import BaseModel, Field
from .base import BaseSchema

class DepartmentBase(BaseSchema):
    """部门基础模型"""
    name: str = Field(..., max_length=100, description="部门名称")
    leader: Optional[str] = Field(None, max_length=20, description="负责人")
    phone: Optional[str] = Field(None, max_length=20, description="电话")
    description: Optional[str] = Field(None, max_length=255, description="部门描述")
    parent_id: Optional[int] = Field(None, description="父部门ID")

class DepartmentCreate(DepartmentBase):
    """创建部门模型"""
    pass

class DepartmentUpdate(DepartmentBase):
    """更新部门模型"""
    pass

class DepartmentSchema(DepartmentBase):
    """部门响应模型"""
    children: List["DepartmentSchema"] = Field([], description="子部门列表")